/**
 * @{#} ${ classPre }Request.java Created on ${ date }
 *
 * Copyright (c) ${ year } by hiwitech.com software.
 */
package ${packageName}.model.request.${moduleName};

import ${packageName}.model.db.${ classPre };
import ${packageName}.model.request.BaseRequest;
import ${packageName}.common.validate.CommandValidator;

/**
 * @author hiwitech
 *         对应表(${ tableName })
 */
public class ${ classPre }Request extends ${ classPre } implements BaseRequest {
	
	@Override
	public void formatCheck() {
		/************非空验证************/
		<#list tableConfig.addFields as addField>
			<#if !fieldMap[addField].canNull && fieldMap[addField].canEdit>
				<#if fieldMap[addField].proType == 'String'>
		CommandValidator.assertNotBlank("${fieldMap[addField].viewName}", this.${fieldMap[addField].proName});
				<#else>
        CommandValidator.assertNotNull("${fieldMap[addField].viewName}", this.${fieldMap[addField].proName});
				</#if>
			</#if>
		</#list>

		if (isAdd()) {
		<#list tableConfig.addFields as addField>
			<#if !fieldMap[addField].canNull && !fieldMap[addField].canEdit>
				<#if fieldMap[addField].proType == 'String'>
			CommandValidator.assertNotBlank("${fieldMap[addField].viewName}", this.${fieldMap[addField].proName});
				<#else>
			CommandValidator.assertNotNull("${fieldMap[addField].viewName}", this.${fieldMap[addField].proName});
				</#if>
			</#if>
		</#list>
		}

		/************字符串长度验证************/
		<#list tableConfig.addFields as addField>
			<#if fieldMap[addField].proType == 'String'>
			<#if fieldMap[addField].minLength?? && fieldMap[addField].minLength gt 0>
        CommandValidator.assertMinLength("${fieldMap[addField].viewName}", this.${fieldMap[addField].proName}, ${fieldMap[addField].minLength?c});
			</#if>
        CommandValidator.assertMaxLength("${fieldMap[addField].viewName}", this.${fieldMap[addField].proName}, ${fieldMap[addField].maxLength?c});
			</#if>
		</#list>

		/************数值验证************/
		<#list tableConfig.addFields as addField>
			<#if fieldMap[addField].proType == 'Integer' || fieldMap[addField].proType == 'Long' || fieldMap[addField].proType == 'BigDecimal'>
		CommandValidator.assertLength("${fieldMap[addField].viewName}", this.${fieldMap[addField].proName}, ${fieldMap[addField].minLength?c}, ${fieldMap[addField].maxLength?c});
			</#if>
		</#list>
	}
}